OBJEXT:=o
SOURCE_DIR := ../library
OBJECT_DIR := ./obj
TARGET_DIR := ../../runimage/linux_x86

include ../rules.mak

all:\
	$(TARGET_DIR)/libspringprox.a \
	$(TARGET_DIR)/libsprox_desfire.a \
	$(TARGET_DIR)/libsprox_mifulc.a \
	$(TARGET_DIR)/libsprox_calypso.a

clean:
	rm -Rf $(OBJECT_DIR)

CFLAGS += -Wall -I $(SOURCE_DIR)

#CCFLAGS+=/D _DEBUG

#
# If you're building for a specific project, or for an embedded target with
# only little resource, you can drop some part of the library :
# - #define SPROX_API_NO_CARD  if your SpringProx product has no smarcard slot
# - #define SPROX_API_NO_MSO   if your SpringProx product has no fingerprint module
#                              (this asserted by default)
# - #define SPROX_API_NO_MIF   if you don't work with Mifare classic cards
# - #define SPROX_API_NO_TCL   if you don't work with ISO 14443-4 cards
# - #define SPROX_API_NO_CRYPT if you don't need cryptographic related stuff
#                              (DES/3-DES ciphering, MD5 hash)
#
# You can also disable some communication protocols you don't need :
# - NO_USB = 1 removes the USB layer
# - #define SPROX_API_NO_FTDI removes the USB layer
# - #define SPROX_API_ONLY_BIN : only the BIN protocol will be provided
# - #define SPROX_API_ONLY_ASC : only the ASCII protocol will be provided
# Default behaviour is to build BIN, ASCII, and modified OSI 3964.
#

#CFLAGS+=-D SPROX_API_NO_CARD
#CFLAGS+=-D SPROX_API_NO_MSO
#CFLAGS+=-D SPROX_API_NO_MIF
#CFLAGS+=-D SPROX_API_NO_TCL
#CFLAGS+=-D SPROX_API_NO_CRYPT
#NO_USB = 1
CFLAGS+=-D SPROX_API_NO_FTDI
#CFLAGS+=-D SPROX_API_ONLY_BIN
#CFLAGS+=-D SPROX_API_ONLY_ASC
#CFLAGS+=-D SPROX_API_NO_MSG
	

$(TARGET_DIR)/libspringprox.a: $(SPRINGPROX_OBJS)
	ar rcu $@ $^
	ranlib $@

$(TARGET_DIR)/libsprox_desfire.a: $(SPROX_DESFIRE_OBJS)
	ar rcu $@ $^
	ranlib $@

$(TARGET_DIR)/libsprox_mifulc.a: $(SPROX_MIFULC_OBJS)
	ar rcu $@ $^
	ranlib $@

$(TARGET_DIR)/libsprox_calypso.a: $(SPROX_CALYPSO_OBJS)
	ar rcu $@ $^
	ranlib $@

$(OBJECT_DIR)/%.$(OBJEXT): $(SOURCE_DIR)/%.c
	- @mkdir -p $(dir $@)
	@echo # - compiling $(notdir $<)
	$(CC) $(CPPFLAGS) $(CFLAGS) -D SPROX_API -c -o $@ $<
